Skip to content

Commit 2ed8093

Browse files
authoredDec 7, 2016
3.9.0 (#791)
1 parent 8bbd939 commit 2ed8093

27 files changed

+121
-53
lines changed
 

‎CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
## 3.9.0
4+
* NEW: `breadcrumbCallback` and `setBreadcrumbCallback` for filtering/mutating breadcrumbs. See: https://github.com/getsentry/raven-js/pull/788
5+
* NEW: Can enable synthetic traces globally via `stacktrace: true` config option. See: https://github.com/getsentry/raven-js/pull/763
6+
* CHANGE: Can set user context via `config` under `user` key. See: https://github.com/getsentry/raven-js/pull/762
7+
* CHANGE: Unit and integration tests now run on PhantomJS 2. See: https://github.com/getsentry/raven-js/pull/777
8+
* BUGFIX: Fix mouse click breadcrumbs not captured in some scenarios. See: https://github.com/getsentry/raven-js/pull/766
9+
* BUGFIX: React Native plugin normalizes paths in stacktraces generated via `captureMessage`. See: https://github.com/getsentry/raven-js/pull/778
10+
* BUGFIX: Doesn't break when window is absent (e.g. inside web workers). See: https://github.com/getsentry/raven-js/pull/785
11+
312
## 3.8.1
413
* BUGFIX: Fix dangling comma affecting IE8. See: https://github.com/getsentry/raven-js/pull/769
514

‎bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "raven-js",
3-
"version": "3.8.0",
3+
"version": "3.9.0",
44
"dependencies": {},
55
"main": "dist/raven.js",
66
"ignore": [

‎dist/plugins/angular.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! Raven.js 3.8.0 (d78f15c) | github.com/getsentry/raven-js */
1+
/*! Raven.js 3.9.0 (8bbd939) | github.com/getsentry/raven-js */
22

33
/*
44
* Includes TraceKit

‎dist/plugins/angular.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/plugins/console.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! Raven.js 3.8.0 (d78f15c) | github.com/getsentry/raven-js */
1+
/*! Raven.js 3.9.0 (8bbd939) | github.com/getsentry/raven-js */
22

33
/*
44
* Includes TraceKit

‎dist/plugins/console.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/plugins/ember.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! Raven.js 3.8.0 (d78f15c) | github.com/getsentry/raven-js */
1+
/*! Raven.js 3.9.0 (8bbd939) | github.com/getsentry/raven-js */
22

33
/*
44
* Includes TraceKit

‎dist/plugins/ember.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/plugins/require.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! Raven.js 3.8.0 (d78f15c) | github.com/getsentry/raven-js */
1+
/*! Raven.js 3.9.0 (8bbd939) | github.com/getsentry/raven-js */
22

33
/*
44
* Includes TraceKit

‎dist/plugins/require.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/plugins/vue.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! Raven.js 3.8.0 (d78f15c) | github.com/getsentry/raven-js */
1+
/*! Raven.js 3.9.0 (8bbd939) | github.com/getsentry/raven-js */
22

33
/*
44
* Includes TraceKit

‎dist/plugins/vue.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/raven.js

+79-20
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! Raven.js 3.8.0 (d78f15c) | github.com/getsentry/raven-js */
1+
/*! Raven.js 3.9.0 (8bbd939) | github.com/getsentry/raven-js */
22

33
/*
44
* Includes TraceKit
@@ -91,6 +91,7 @@ module.exports = {
9191
};
9292

9393
},{}],4:[function(_dereq_,module,exports){
94+
(function (global){
9495
/*global XDomainRequest:false, __DEV__:false*/
9596
'use strict';
9697

@@ -107,8 +108,12 @@ function now() {
107108
return +new Date();
108109
}
109110

110-
var _window = typeof window !== 'undefined' ? window : undefined;
111-
var _document = _window && _window.document;
111+
// This is to be defensive in environments where window does not exist (see https://github.com/getsentry/raven-js/pull/785)
112+
var _window = typeof window !== 'undefined' ? window
113+
: typeof global !== 'undefined' ? global
114+
: typeof self !== 'undefined' ? self
115+
: {};
116+
var _document = _window.document;
112117

113118
// First, check for JSON support
114119
// If there is no JSON, we no-op the core features of Raven
@@ -167,7 +172,7 @@ Raven.prototype = {
167172
// webpack (using a build step causes webpack #1617). Grunt verifies that
168173
// this value matches package.json during build.
169174
// See: https://github.com/getsentry/raven-js/issues/465
170-
VERSION: '3.8.0',
175+
VERSION: '3.9.0',
171176

172177
debug: false,
173178

@@ -195,7 +200,7 @@ Raven.prototype = {
195200
if (options) {
196201
each(options, function(key, value){
197202
// tags and extra are special and need to be put into context
198-
if (key === 'tags' || key === 'extra') {
203+
if (key === 'tags' || key === 'extra' || key === 'user') {
199204
self._globalContext[key] = value;
200205
} else {
201206
globalOptions[key] = value;
@@ -221,7 +226,7 @@ Raven.prototype = {
221226
xhr: true,
222227
console: true,
223228
dom: true,
224-
location: true,
229+
location: true
225230
};
226231

227232
var autoBreadcrumbs = globalOptions.autoBreadcrumbs;
@@ -456,11 +461,13 @@ Raven.prototype = {
456461
return;
457462
}
458463

464+
options = options || {};
465+
459466
var data = objectMerge({
460467
message: msg + '' // Make sure it's actually a string
461468
}, options);
462469

463-
if (options && options.stacktrace) {
470+
if (this._globalOptions.stacktrace || (options && options.stacktrace)) {
464471
var ex;
465472
// create a stack trace from this point; just trim
466473
// off extra frames so they don't include this function call (or
@@ -500,6 +507,16 @@ Raven.prototype = {
500507
timestamp: now() / 1000
501508
}, obj);
502509

510+
if (isFunction(this._globalOptions.breadcrumbCallback)) {
511+
var result = this._globalOptions.breadcrumbCallback(crumb);
512+
513+
if (isObject(result) && !isEmptyObject(result)) {
514+
crumb = result;
515+
} else if (result === false) {
516+
return this;
517+
}
518+
}
519+
503520
this._breadcrumbs.push(crumb);
504521
if (this._breadcrumbs.length > this._globalOptions.maxBreadcrumbs) {
505522
this._breadcrumbs.shift();
@@ -617,6 +634,22 @@ Raven.prototype = {
617634
return this;
618635
},
619636

637+
/*
638+
* Set the breadcrumbCallback option
639+
*
640+
* @param {function} callback The callback to run which allows filtering
641+
* or mutating breadcrumbs
642+
* @return {Raven}
643+
*/
644+
setBreadcrumbCallback: function(callback) {
645+
var original = this._globalOptions.breadcrumbCallback;
646+
this._globalOptions.breadcrumbCallback = isFunction(callback)
647+
? function (data) { return callback(data, original); }
648+
: callback;
649+
650+
return this;
651+
},
652+
620653
/*
621654
* Set the shouldSendCallback option
622655
*
@@ -827,7 +860,6 @@ Raven.prototype = {
827860
// TODO: if somehow user switches keypress target before
828861
// debounce timeout is triggered, we will only capture
829862
// a single breadcrumb from the FIRST target (acceptable?)
830-
831863
return function (evt) {
832864
var target = evt.target,
833865
tagName = target && target.tagName;
@@ -846,7 +878,7 @@ Raven.prototype = {
846878
}
847879
clearTimeout(timeout);
848880
self._keypressTimeout = setTimeout(function () {
849-
self._keypressTimeout = null;
881+
self._keypressTimeout = null;
850882
}, debounceDuration);
851883
};
852884
},
@@ -932,13 +964,24 @@ Raven.prototype = {
932964

933965
// More breadcrumb DOM capture ... done here and not in `_instrumentBreadcrumbs`
934966
// so that we don't have more than one wrapper function
935-
var before;
967+
var before,
968+
clickHandler,
969+
keypressHandler;
970+
936971
if (autoBreadcrumbs && autoBreadcrumbs.dom && (global === 'EventTarget' || global === 'Node')) {
937-
if (evtName === 'click'){
938-
before = self._breadcrumbEventHandler(evtName);
939-
} else if (evtName === 'keypress') {
940-
before = self._keypressEventHandler();
941-
}
972+
// NOTE: generating multiple handlers per addEventListener invocation, should
973+
// revisit and verify we can just use one (almost certainly)
974+
clickHandler = self._breadcrumbEventHandler('click');
975+
keypressHandler = self._keypressEventHandler();
976+
before = function (evt) {
977+
// need to intercept every DOM event in `before` argument, in case that
978+
// same wrapped method is re-used for different events (e.g. mousemove THEN click)
979+
// see #724
980+
if (evt.type === 'click')
981+
return clickHandler(evt);
982+
else if (evt.type === 'keypress')
983+
return keypressHandler(evt);
984+
};
942985
}
943986
return orig.call(this, evtName, self.wrap(fn, undefined, before), capture, secure);
944987
};
@@ -1849,7 +1892,9 @@ Raven.prototype.setReleaseContext = Raven.prototype.setRelease;
18491892

18501893
module.exports = Raven;
18511894

1895+
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
18521896
},{"1":1,"2":2,"3":3,"6":6}],5:[function(_dereq_,module,exports){
1897+
(function (global){
18531898
/**
18541899
* Enforces a single instance of the Raven client, and the
18551900
* main entry point for Raven. If you are a consumer of the
@@ -1860,7 +1905,12 @@ module.exports = Raven;
18601905

18611906
var RavenConstructor = _dereq_(4);
18621907

1863-
var _Raven = window.Raven;
1908+
// This is to be defensive in environments where window does not exist (see https://github.com/getsentry/raven-js/pull/785)
1909+
var _window = typeof window !== 'undefined' ? window
1910+
: typeof global !== 'undefined' ? global
1911+
: typeof self !== 'undefined' ? self
1912+
: {};
1913+
var _Raven = _window.Raven;
18641914

18651915
var Raven = new RavenConstructor();
18661916

@@ -1871,15 +1921,17 @@ var Raven = new RavenConstructor();
18711921
* @return {Raven}
18721922
*/
18731923
Raven.noConflict = function () {
1874-
window.Raven = _Raven;
1924+
_window.Raven = _Raven;
18751925
return Raven;
18761926
};
18771927

18781928
Raven.afterLoad();
18791929

18801930
module.exports = Raven;
18811931

1932+
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
18821933
},{"4":4}],6:[function(_dereq_,module,exports){
1934+
(function (global){
18831935
'use strict';
18841936

18851937
/*
@@ -1892,6 +1944,12 @@ var TraceKit = {
18921944
debug: false
18931945
};
18941946

1947+
// This is to be defensive in environments where window does not exist (see https://github.com/getsentry/raven-js/pull/785)
1948+
var _window = typeof window !== 'undefined' ? window
1949+
: typeof global !== 'undefined' ? global
1950+
: typeof self !== 'undefined' ? self
1951+
: {};
1952+
18951953
// global reference to slice
18961954
var _slice = [].slice;
18971955
var UNKNOWN_FUNCTION = '?';
@@ -2070,8 +2128,8 @@ TraceKit.report = (function reportModuleWrapper() {
20702128
if (_onErrorHandlerInstalled) {
20712129
return;
20722130
}
2073-
_oldOnerrorHandler = window.onerror;
2074-
window.onerror = traceKitWindowOnError;
2131+
_oldOnerrorHandler = _window.onerror;
2132+
_window.onerror = traceKitWindowOnError;
20752133
_onErrorHandlerInstalled = true;
20762134
}
20772135

@@ -2080,7 +2138,7 @@ TraceKit.report = (function reportModuleWrapper() {
20802138
if (!_onErrorHandlerInstalled) {
20812139
return;
20822140
}
2083-
window.onerror = _oldOnerrorHandler;
2141+
_window.onerror = _oldOnerrorHandler;
20842142
_onErrorHandlerInstalled = false;
20852143
_oldOnerrorHandler = undefined;
20862144
}
@@ -2482,5 +2540,6 @@ TraceKit.computeStackTrace = (function computeStackTraceWrapper() {
24822540

24832541
module.exports = TraceKit;
24842542

2543+
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
24852544
},{}]},{},[5])(5)
24862545
});

‎dist/raven.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/raven.min.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/sri.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
{
22
"@dist/raven.js": {
33
"hashes": {
4-
"sha256": "4miBSrBY0YRTMgqQ7tIKJ5bC1iJWSDJcg+lYca93DVI=",
5-
"sha512": "ziKXaLU8oaGyZRk4MrdPLqejNAcAr+vvUg+OpMGrQ1tr6j2TK11OLn3RkawUOomzxCz6VgIBA7b3wLco9jmEeA=="
4+
"sha256": "ihdEI9/hV9q/+yUm+WxgLgncmbFnuK9tr/lRnRgr60k=",
5+
"sha512": "4WMClk7qzYHXT5/xR3X9RkpNs8dg/FIfbJ7RTythr9rXMRAVIDimD2X6NLEUdID+c7sJ3b6oOvsmf6oB0ORhwg=="
66
},
77
"type": null,
8-
"integrity": "sha256-4miBSrBY0YRTMgqQ7tIKJ5bC1iJWSDJcg+lYca93DVI= sha512-ziKXaLU8oaGyZRk4MrdPLqejNAcAr+vvUg+OpMGrQ1tr6j2TK11OLn3RkawUOomzxCz6VgIBA7b3wLco9jmEeA==",
8+
"integrity": "sha256-ihdEI9/hV9q/+yUm+WxgLgncmbFnuK9tr/lRnRgr60k= sha512-4WMClk7qzYHXT5/xR3X9RkpNs8dg/FIfbJ7RTythr9rXMRAVIDimD2X6NLEUdID+c7sJ3b6oOvsmf6oB0ORhwg==",
99
"path": "dist/raven.js"
1010
},
1111
"@dist/raven.min.js": {
1212
"hashes": {
13-
"sha256": "qP1Ly+j8g4xsul2MZaCZv6byFgLvRHuiI/bct6JluOw=",
14-
"sha512": "EQGo6LBb2E0sCr7jfkQN7d3wzdFcWWD8b0FxP/Dahoa827Wk9KpsxSsA6IS8B+RNGkUHLaOP5G21p+EA3odqBA=="
13+
"sha256": "Iwsp4zEtQhPhOFbMNyTevyNpy7XTm8qUPteSJyopHDM=",
14+
"sha512": "lL3X3M9f+DKT/mcKDJWixbXdXhVlYGWxy5DuPYyV6LrD8KNWQJ6ahpvTK3IyosXEAj3x+PWQ1DnFbKyGbIGdBw=="
1515
},
1616
"type": null,
17-
"integrity": "sha256-qP1Ly+j8g4xsul2MZaCZv6byFgLvRHuiI/bct6JluOw= sha512-EQGo6LBb2E0sCr7jfkQN7d3wzdFcWWD8b0FxP/Dahoa827Wk9KpsxSsA6IS8B+RNGkUHLaOP5G21p+EA3odqBA==",
17+
"integrity": "sha256-Iwsp4zEtQhPhOFbMNyTevyNpy7XTm8qUPteSJyopHDM= sha512-lL3X3M9f+DKT/mcKDJWixbXdXhVlYGWxy5DuPYyV6LrD8KNWQJ6ahpvTK3IyosXEAj3x+PWQ1DnFbKyGbIGdBw==",
1818
"path": "dist/raven.min.js"
1919
}
2020
}

0 commit comments

Comments
 (0)
Please sign in to comment.