ravenjs-gem 1.1.14 → 1.1.16

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,4 +1,4 @@
1
- /*! Raven.js 1.1.14 (f9803bd) | github.com/getsentry/raven-js */
1
+ /*! Raven.js 1.1.16 (463f68f) | github.com/getsentry/raven-js */
2
2
 
3
3
  /*
4
4
  * Includes TraceKit
@@ -559,7 +559,7 @@ TraceKit.computeStackTrace = (function computeStackTraceWrapper() {
559
559
  re = new RegExp(escapeRegExp(code).replace(/\s+/g, '\\s+'));
560
560
  }
561
561
 
562
- // not sure if this is really necessary, but I don’t have a test
562
+ // not sure if this is really necessary, but I dont have a test
563
563
  // corpus large enough to confirm that and it was in the original.
564
564
  else {
565
565
  var name = parts[1] ? '\\s+' + parts[1] : '',
@@ -645,8 +645,8 @@ TraceKit.computeStackTrace = (function computeStackTraceWrapper() {
645
645
  return null;
646
646
  }
647
647
 
648
- var chrome = /^\s*at (?:((?:\[object object\])?\S+(?: \[as \S+\])?) )?\(?((?:file|https?):.*?):(\d+)(?::(\d+))?\)?\s*$/i,
649
- gecko = /^\s*(\S*)(?:\((.*?)\))?@((?:file|https?).*?):(\d+)(?::(\d+))?\s*$/i,
648
+ var chrome = /^\s*at (?:((?:\[object object\])?\S+(?: \[as \S+\])?) )?\(?((?:file|https?|chrome-extension):.*?):(\d+)(?::(\d+))?\)?\s*$/i,
649
+ gecko = /^\s*(\S*)(?:\((.*?)\))?@((?:file|https?|chrome).*?):(\d+)(?::(\d+))?\s*$/i,
650
650
  lines = ex.stack.split('\n'),
651
651
  stack = [],
652
652
  parts,
@@ -1108,7 +1108,8 @@ var _Raven = window.Raven,
1108
1108
  tags: {},
1109
1109
  extra: {}
1110
1110
  },
1111
- authQueryString;
1111
+ authQueryString,
1112
+ isRavenInstalled = false;
1112
1113
 
1113
1114
  /*
1114
1115
  * The core Raven singleton
@@ -1116,7 +1117,9 @@ var _Raven = window.Raven,
1116
1117
  * @this {Raven}
1117
1118
  */
1118
1119
  var Raven = {
1119
- VERSION: '1.1.14',
1120
+ VERSION: '1.1.16',
1121
+
1122
+ debug: true,
1120
1123
 
1121
1124
  /*
1122
1125
  * Allow multiple versions of Raven to be installed.
@@ -1137,6 +1140,10 @@ var Raven = {
1137
1140
  * @return {Raven}
1138
1141
  */
1139
1142
  config: function(dsn, options) {
1143
+ if (globalServer) {
1144
+ logDebug('error', 'Error: Raven has already been configured');
1145
+ return Raven;
1146
+ }
1140
1147
  if (!dsn) return Raven;
1141
1148
 
1142
1149
  var uri = parseDSN(dsn),
@@ -1155,6 +1162,10 @@ var Raven = {
1155
1162
  globalOptions.ignoreErrors.push('Script error.');
1156
1163
  globalOptions.ignoreErrors.push('Script error');
1157
1164
 
1165
+ // Other variants of external script errors:
1166
+ globalOptions.ignoreErrors.push('Javascript error: Script error on line 0');
1167
+ globalOptions.ignoreErrors.push('Javascript error: Script error. on line 0');
1168
+
1158
1169
  // join regexp rules into one big rule
1159
1170
  globalOptions.ignoreErrors = joinRegExp(globalOptions.ignoreErrors);
1160
1171
  globalOptions.ignoreUrls = globalOptions.ignoreUrls.length ? joinRegExp(globalOptions.ignoreUrls) : false;
@@ -1198,8 +1209,9 @@ var Raven = {
1198
1209
  * @return {Raven}
1199
1210
  */
1200
1211
  install: function() {
1201
- if (isSetup()) {
1212
+ if (isSetup() && !isRavenInstalled) {
1202
1213
  TraceKit.report.subscribe(handleStackInfo);
1214
+ isRavenInstalled = true;
1203
1215
  }
1204
1216
 
1205
1217
  return Raven;
@@ -1273,7 +1285,7 @@ var Raven = {
1273
1285
 
1274
1286
  // copy over properties of the old function
1275
1287
  for (var property in func) {
1276
- if (func.hasOwnProperty(property)) {
1288
+ if (hasKey(func, property)) {
1277
1289
  wrapped[property] = func[property];
1278
1290
  }
1279
1291
  }
@@ -1293,6 +1305,7 @@ var Raven = {
1293
1305
  */
1294
1306
  uninstall: function() {
1295
1307
  TraceKit.report.uninstall();
1308
+ isRavenInstalled = false;
1296
1309
 
1297
1310
  return Raven;
1298
1311
  },
@@ -1305,8 +1318,8 @@ var Raven = {
1305
1318
  * @return {Raven}
1306
1319
  */
1307
1320
  captureException: function(ex, options) {
1308
- // If a string is passed through, recall as a message
1309
- if (isString(ex)) return Raven.captureMessage(ex, options);
1321
+ // If not an Error is passed through, recall as a message instead
1322
+ if (!(ex instanceof Error)) return Raven.captureMessage(ex, options);
1310
1323
 
1311
1324
  // Store the raw exception object for potential debugging and introspection
1312
1325
  lastCapturedException = ex;
@@ -1338,7 +1351,7 @@ var Raven = {
1338
1351
  // Fire away!
1339
1352
  send(
1340
1353
  objectMerge({
1341
- message: msg
1354
+ message: msg + '' // Make sure it's actually a string
1342
1355
  }, options)
1343
1356
  );
1344
1357
 
@@ -1351,12 +1364,36 @@ var Raven = {
1351
1364
  * @param {object} user An object representing user data [optional]
1352
1365
  * @return {Raven}
1353
1366
  */
1354
- setUser: function(user) {
1367
+ setUserContext: function(user) {
1355
1368
  globalUser = user;
1356
1369
 
1357
1370
  return Raven;
1358
1371
  },
1359
1372
 
1373
+ /*
1374
+ * Set extra attributes to be sent along with the payload.
1375
+ *
1376
+ * @param {object} extra An object representing extra data [optional]
1377
+ * @return {Raven}
1378
+ */
1379
+ setExtraContext: function(extra) {
1380
+ globalOptions.extra = extra || {};
1381
+
1382
+ return Raven;
1383
+ },
1384
+
1385
+ /*
1386
+ * Set tags to be sent along with the payload.
1387
+ *
1388
+ * @param {object} tags An object representing tags [optional]
1389
+ * @return {Raven}
1390
+ */
1391
+ setTagsContext: function(tags) {
1392
+ globalOptions.tags = tags || {};
1393
+
1394
+ return Raven;
1395
+ },
1396
+
1360
1397
  /*
1361
1398
  * Get the latest raw exception that was captured by Raven.
1362
1399
  *
@@ -1376,6 +1413,8 @@ var Raven = {
1376
1413
  }
1377
1414
  };
1378
1415
 
1416
+ Raven.setUser = Raven.setUserContext; // To be deprecated
1417
+
1379
1418
  function triggerEvent(eventType, options) {
1380
1419
  var event, key;
1381
1420
 
@@ -1391,7 +1430,7 @@ function triggerEvent(eventType, options) {
1391
1430
  event.eventType = eventType;
1392
1431
  }
1393
1432
 
1394
- for (key in options) if (options.hasOwnProperty(key)) {
1433
+ for (key in options) if (hasKey(options, key)) {
1395
1434
  event[key] = options[key];
1396
1435
  }
1397
1436
 
@@ -1468,7 +1507,7 @@ function each(obj, callback) {
1468
1507
 
1469
1508
  if (isUndefined(obj.length)) {
1470
1509
  for (i in obj) {
1471
- if (obj.hasOwnProperty(i)) {
1510
+ if (hasKey(obj, i)) {
1472
1511
  callback.call(null, i, obj[i]);
1473
1512
  }
1474
1513
  }
@@ -1541,7 +1580,7 @@ function normalizeFrame(frame) {
1541
1580
  // Now we check for fun, if the function name is Raven or TraceKit
1542
1581
  /(Raven|TraceKit)\./.test(normalized['function']) ||
1543
1582
  // finally, we do a last ditch effort and check for raven.min.js
1544
- /raven\.(min\.)js$/.test(normalized.filename)
1583
+ /raven\.(min\.)?js$/.test(normalized.filename)
1545
1584
  );
1546
1585
 
1547
1586
  return normalized;
@@ -1589,6 +1628,10 @@ function extractContextFromFrame(frame) {
1589
1628
  function processException(type, message, fileurl, lineno, frames, options) {
1590
1629
  var stacktrace, label, i;
1591
1630
 
1631
+ // In some instances message is not actually a string, no idea why,
1632
+ // so we want to always coerce it to one.
1633
+ message += '';
1634
+
1592
1635
  // Sometimes an exception is getting logged in Sentry as
1593
1636
  // <no message value>
1594
1637
  // This can only mean that the message was falsey since this value
@@ -1732,9 +1775,7 @@ function makeRequest(data) {
1732
1775
  function isSetup() {
1733
1776
  if (!hasJSON) return false; // needs JSON support
1734
1777
  if (!globalServer) {
1735
- if (window.console && console.error) {
1736
- console.error("Error: Raven has not been configured.");
1737
- }
1778
+ logDebug('error', 'Error: Raven has not been configured.');
1738
1779
  return false;
1739
1780
  }
1740
1781
  return true;
@@ -1771,6 +1812,12 @@ function uuid4() {
1771
1812
  });
1772
1813
  }
1773
1814
 
1815
+ function logDebug(level, message) {
1816
+ if (window.console && console[level] && Raven.debug) {
1817
+ console[level](message);
1818
+ }
1819
+ }
1820
+
1774
1821
  function afterLoad() {
1775
1822
  // Attempt to initialize Raven on load
1776
1823
  var RavenConfig = window.RavenConfig;
@@ -1789,37 +1836,3 @@ if (typeof define === 'function' && define.amd) {
1789
1836
  }
1790
1837
 
1791
1838
  })(this);
1792
-
1793
- /**
1794
- * native plugin
1795
- *
1796
- * Extends support for global error handling for asynchronous browser
1797
- * functions. Adopted from Closure Library's errorhandler.js
1798
- */
1799
- ;(function extendToAsynchronousCallbacks(window, Raven) {
1800
- "use strict";
1801
-
1802
- var _helper = function _helper(fnName) {
1803
- var originalFn = window[fnName];
1804
- window[fnName] = function ravenAsyncExtension() {
1805
- // Make a copy of the arguments
1806
- var args = [].slice.call(arguments);
1807
- var originalCallback = args[0];
1808
- if (typeof (originalCallback) === 'function') {
1809
- args[0] = Raven.wrap(originalCallback);
1810
- }
1811
- // IE < 9 doesn't support .call/.apply on setInterval/etTimeout, but it
1812
- // also only supports 2 argument and doesn't care what this" is, so we
1813
- // can just call the original function directly.
1814
- if (originalFn.apply) {
1815
- return originalFn.apply(this, args);
1816
- } else {
1817
- return originalFn(args[0], args[1]);
1818
- }
1819
- };
1820
- };
1821
-
1822
- _helper('setTimeout');
1823
- _helper('setInterval');
1824
-
1825
- }(this, Raven));
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ravenjs-gem
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.14
4
+ version: 1.1.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Vuerings
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-04-25 00:00:00.000000000 Z
13
+ date: 2014-07-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: railties
@@ -60,6 +60,7 @@ files:
60
60
  - vendor/assets/javascripts/1.0.7/raven.min.js
61
61
  - vendor/assets/javascripts/1.0.7/raven.min.map
62
62
  - vendor/assets/javascripts/1.1.14/raven.js
63
+ - vendor/assets/javascripts/1.1.16/raven.js
63
64
  - vendor/assets/javascripts/raven.js
64
65
  homepage: http://github.com/ets-berkeley-edu/ravenjs-gem
65
66
  licenses: []