| @@ -1,4 +1,4 @@ |
| 1 | | −/*! Raven.js 3.11.0 (cb87941) | github.com/getsentry/raven-js */ |
| 1 | +/*! Raven.js 3.13.1 (f55d281) | github.com/getsentry/raven-js */ |
| 2 | 2 | |
| 3 | 3 | /* |
| 4 | 4 | * Includes TraceKit |
| @@ -11,35 +11,6 @@ · 6 unmodified lines |
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Raven = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ |
| 14 | | −exports = module.exports = stringify |
| 15 | | −exports.getSerialize = serializer |
| 16 | | − |
| 17 | | −function stringify(obj, replacer, spaces, cycleReplacer) { |
| 18 | | − return JSON.stringify(obj, serializer(replacer, cycleReplacer), spaces) |
| 19 | | −} |
| 20 | | − |
| 21 | | −function serializer(replacer, cycleReplacer) { |
| 22 | | − var stack = [], keys = [] |
| 23 | | − |
| 24 | | − if (cycleReplacer == null) cycleReplacer = function(key, value) { |
| 25 | | − if (stack[0] === value) return "[Circular ~]" |
| 26 | | − return "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]" |
| 27 | | − } |
| 28 | | − |
| 29 | | − return function(key, value) { |
| 30 | | − if (stack.length > 0) { |
| 31 | | − var thisPos = stack.indexOf(this) |
| 32 | | − ~thisPos ? stack.splice(thisPos + 1) : stack.push(this) |
| 33 | | − ~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key) |
| 34 | | − if (~stack.indexOf(value)) value = cycleReplacer.call(this, key, value) |
| 35 | | − } |
| 36 | | − else stack.push(value) |
| 37 | | − |
| 38 | | − return replacer == null ? value : replacer.call(this, key, value) |
| 39 | | − } |
| 40 | | −} |
| 41 | | − |
| 42 | | −},{}],2:[function(_dereq_,module,exports){ |
| 43 | 14 | 'use strict'; |
| 44 | 15 | |
| 45 | 16 | function RavenConfigError(message) { |
| @@ -51,7 +22,7 @@ RavenConfigError.prototype.constructor = RavenConfigError; · 5 unmodified lines |
| 51 | 22 | |
| 52 | 23 | module.exports = RavenConfigError; |
| 53 | 24 | |
| 54 | | −},{}],3:[function(_dereq_,module,exports){ |
| 25 | +},{}],2:[function(_dereq_,module,exports){ |
| 55 | 26 | 'use strict'; |
| 56 | 27 | |
| 57 | 28 | var wrapMethod = function(console, level, callback) { |
| @@ -90,16 +61,20 @@ module.exports = { · 32 unmodified lines |
| 90 | 61 | wrapMethod: wrapMethod |
| 91 | 62 | }; |
| 92 | 63 | |
| 93 | | −},{}],4:[function(_dereq_,module,exports){ |
| 64 | +},{}],3:[function(_dereq_,module,exports){ |
| 94 | 65 | (function (global){ |
| 95 | 66 | /*global XDomainRequest:false, __DEV__:false*/ |
| 96 | 67 | 'use strict'; |
| 97 | 68 | |
| 98 | 69 | var TraceKit = _dereq_(6); |
| 99 | | −var RavenConfigError = _dereq_(2); |
| 100 | | −var stringify = _dereq_(1); |
| 70 | +var stringify = _dereq_(7); |
| 71 | +var RavenConfigError = _dereq_(1); |
| 72 | +var utils = _dereq_(5); |
| 73 | + |
| 74 | +var isError = utils.isError, |
| 75 | + isObject = utils.isObject; |
| 101 | 76 | |
| 102 | | −var wrapConsoleMethod = _dereq_(3).wrapMethod; |
| 77 | +var wrapConsoleMethod = _dereq_(2).wrapMethod; |
| 103 | 78 | |
| 104 | 79 | var dsnKeys = 'source protocol user pass host port path'.split(' '), |
| 105 | 80 | dsnPattern = /^(?:(\w+):)?\/\/(?:(\w+)(:\w+)?@)?([\w\.-]+)(?::(\d+))?(\/.*)/; |
| @@ -141,7 +116,8 @@ function Raven() { · 35 unmodified lines |
| 141 | 116 | collectWindowErrors: true, |
| 142 | 117 | maxMessageLength: 0, |
| 143 | 118 | stackTraceLimit: 50, |
| 144 | | − autoBreadcrumbs: true |
| 119 | + autoBreadcrumbs: true, |
| 120 | + sampleRate: 1 |
| 145 | 121 | }; |
| 146 | 122 | this._ignoreOnError = 0; |
| 147 | 123 | this._isRavenInstalled = false; |
| @@ -176,7 +152,7 @@ Raven.prototype = { · 28 unmodified lines |
| 176 | 152 | // webpack (using a build step causes webpack #1617). Grunt verifies that |
| 177 | 153 | // this value matches package.json during build. |
| 178 | 154 | // See: https://github.com/getsentry/raven-js/issues/465 |
| 179 | | − VERSION: '3.11.0', |
| 155 | + VERSION: '3.13.1', |
| 180 | 156 | |
| 181 | 157 | debug: false, |
| 182 | 158 | |
| @@ -1578,7 +1554,13 @@ Raven.prototype = { · 1395 unmodified lines |
| 1578 | 1554 | return; |
| 1579 | 1555 | } |
| 1580 | 1556 | |
| 1581 | | − this._sendProcessedPayload(data); |
| 1557 | + if (typeof globalOptions.sampleRate === 'number') { |
| 1558 | + if (Math.random() < globalOptions.sampleRate) { |
| 1559 | + this._sendProcessedPayload(data); |
| 1560 | + } |
| 1561 | + } else { |
| 1562 | + this._sendProcessedPayload(data); |
| 1563 | + } |
| 1582 | 1564 | }, |
| 1583 | 1565 | |
| 1584 | 1566 | _getUuid: function () { |
| @@ -1674,24 +1656,18 @@ Raven.prototype = { · 89 unmodified lines |
| 1674 | 1656 | if (!hasCORS) return; |
| 1675 | 1657 | |
| 1676 | 1658 | var url = opts.url; |
| 1677 | | − function handler() { |
| 1678 | | − if (request.status === 200) { |
| 1679 | | − if (opts.onSuccess) { |
| 1680 | | − opts.onSuccess(); |
| 1681 | | − } |
| 1682 | | − } else if (opts.onError) { |
| 1683 | | − var err = new Error('Sentry error code: ' + request.status); |
| 1684 | | − err.request = request; |
| 1685 | | − opts.onError(err); |
| 1686 | | − } |
| 1687 | | − } |
| 1688 | 1659 | |
| 1689 | 1660 | if ('withCredentials' in request) { |
| 1690 | 1661 | request.onreadystatechange = function () { |
| 1691 | 1662 | if (request.readyState !== 4) { |
| 1692 | 1663 | return; |
| 1664 | + } else if (request.status === 200) { |
| 1665 | + opts.onSuccess && opts.onSuccess(); |
| 1666 | + } else if (opts.onError) { |
| 1667 | + var err = new Error('Sentry error code: ' + request.status); |
| 1668 | + err.request = request; |
| 1669 | + opts.onError(err); |
| 1693 | 1670 | } |
| 1694 | | − handler(); |
| 1695 | 1671 | }; |
| 1696 | 1672 | } else { |
| 1697 | 1673 | request = new XDomainRequest(); |
| @@ -1700,7 +1676,16 @@ Raven.prototype = { · 2 unmodified lines |
| 1700 | 1676 | url = url.replace(/^https?:/, ''); |
| 1701 | 1677 | |
| 1702 | 1678 | // onreadystatechange not supported by XDomainRequest |
| 1703 | | − request.onload = handler; |
| 1679 | + if (opts.onSuccess) { |
| 1680 | + request.onload = opts.onSuccess; |
| 1681 | + } |
| 1682 | + if (opts.onError) { |
| 1683 | + request.onerror = function () { |
| 1684 | + var err = new Error('Sentry error code: XDomainRequest'); |
| 1685 | + err.request = request; |
| 1686 | + opts.onError(err); |
| 1687 | + } |
| 1688 | + } |
| 1704 | 1689 | } |
| 1705 | 1690 | |
| 1706 | 1691 | // NOTE: auth is intentionally sent as part of query string (NOT as custom |
| @@ -1749,25 +1734,12 @@ function isString(what) { · 42 unmodified lines |
| 1749 | 1734 | return objectPrototype.toString.call(what) === '[object String]'; |
| 1750 | 1735 | } |
| 1751 | 1736 | |
| 1752 | | −function isObject(what) { |
| 1753 | | − return typeof what === 'object' && what !== null; |
| 1754 | | −} |
| 1755 | 1737 | |
| 1756 | 1738 | function isEmptyObject(what) { |
| 1757 | 1739 | for (var _ in what) return false; // eslint-disable-line guard-for-in, no-unused-vars |
| 1758 | 1740 | return true; |
| 1759 | 1741 | } |
| 1760 | 1742 | |
| 1761 | | −// Sorta yanked from https://github.com/joyent/node/blob/aa3b4b4/lib/util.js#L560 |
| 1762 | | −// with some tiny modifications |
| 1763 | | −function isError(what) { |
| 1764 | | − var toString = objectPrototype.toString.call(what); |
| 1765 | | − return isObject(what) && |
| 1766 | | − toString === '[object Error]' || |
| 1767 | | − toString === '[object Exception]' || // Firefox NS_ERROR_FAILURE Exceptions |
| 1768 | | − what instanceof Error; |
| 1769 | | −} |
| 1770 | | − |
| 1771 | 1743 | function each(obj, callback) { |
| 1772 | 1744 | var i, j; |
| 1773 | 1745 | |
| @@ -2067,7 +2039,7 @@ Raven.prototype.setReleaseContext = Raven.prototype.setRelease; · 293 unmodified lines |
| 2067 | 2039 | module.exports = Raven; |
| 2068 | 2040 | |
| 2069 | 2041 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) |
| 2070 | | −},{"1":1,"2":2,"3":3,"6":6}],5:[function(_dereq_,module,exports){ |
| 2042 | +},{"1":1,"2":2,"5":5,"6":6,"7":7}],4:[function(_dereq_,module,exports){ |
| 2071 | 2043 | (function (global){ |
| 2072 | 2044 | /** |
| 2073 | 2045 | * Enforces a single instance of the Raven client, and the |
| @@ -2077,7 +2049,7 @@ module.exports = Raven; · 3 unmodified lines |
| 2077 | 2049 | |
| 2078 | 2050 | 'use strict'; |
| 2079 | 2051 | |
| 2080 | | −var RavenConstructor = _dereq_(4); |
| 2052 | +var RavenConstructor = _dereq_(3); |
| 2081 | 2053 | |
| 2082 | 2054 | // This is to be defensive in environments where window does not exist (see https://github.com/getsentry/raven-js/pull/785) |
| 2083 | 2055 | var _window = typeof window !== 'undefined' ? window |
| @@ -2104,10 +2076,33 @@ Raven.afterLoad(); · 20 unmodified lines |
| 2104 | 2076 | module.exports = Raven; |
| 2105 | 2077 | |
| 2106 | 2078 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) |
| 2107 | | −},{"4":4}],6:[function(_dereq_,module,exports){ |
| 2079 | +},{"3":3}],5:[function(_dereq_,module,exports){ |
| 2080 | +'use strict'; |
| 2081 | + |
| 2082 | +function isObject(what) { |
| 2083 | + return typeof what === 'object' && what !== null; |
| 2084 | +} |
| 2085 | + |
| 2086 | +// Sorta yanked from https://github.com/joyent/node/blob/aa3b4b4/lib/util.js#L560 |
| 2087 | +// with some tiny modifications |
| 2088 | +function isError(what) { |
| 2089 | + var toString = {}.toString.call(what); |
| 2090 | + return isObject(what) && |
| 2091 | + toString === '[object Error]' || |
| 2092 | + toString === '[object Exception]' || // Firefox NS_ERROR_FAILURE Exceptions |
| 2093 | + what instanceof Error; |
| 2094 | +} |
| 2095 | + |
| 2096 | +module.exports = { |
| 2097 | + isObject: isObject, |
| 2098 | + isError: isError |
| 2099 | +}; |
| 2100 | +},{}],6:[function(_dereq_,module,exports){ |
| 2108 | 2101 | (function (global){ |
| 2109 | 2102 | 'use strict'; |
| 2110 | 2103 | |
| 2104 | +var utils = _dereq_(5); |
| 2105 | + |
| 2111 | 2106 | /* |
| 2112 | 2107 | TraceKit - Cross brower stack traces |
| 2113 | 2108 | |
| @@ -2134,7 +2129,7 @@ var _slice = [].slice; · 20 unmodified lines |
| 2134 | 2129 | var UNKNOWN_FUNCTION = '?'; |
| 2135 | 2130 | |
| 2136 | 2131 | // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#Error_types |
| 2137 | | −var ERROR_TYPES_RE = /^(?:Uncaught (?:exception: )?)?((?:Eval|Internal|Range|Reference|Syntax|Type|URI)Error): ?(.*)$/; |
| 2132 | +var ERROR_TYPES_RE = /^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/; |
| 2138 | 2133 | |
| 2139 | 2134 | function getLocationHref() { |
| 2140 | 2135 | if (typeof document === 'undefined' || typeof document.location === 'undefined') |
| @@ -2143,6 +2138,7 @@ function getLocationHref() { · 2 unmodified lines |
| 2143 | 2138 | return document.location.href; |
| 2144 | 2139 | } |
| 2145 | 2140 | |
| 2141 | + |
| 2146 | 2142 | /** |
| 2147 | 2143 | * TraceKit.report: cross-browser processing of unhandled exceptions |
| 2148 | 2144 | * |
| @@ -2260,7 +2256,9 @@ TraceKit.report = (function reportModuleWrapper() { · 111 unmodified lines |
| 2260 | 2256 | if (lastExceptionStack) { |
| 2261 | 2257 | TraceKit.computeStackTrace.augmentStackTraceWithInitialElement(lastExceptionStack, url, lineNo, message); |
| 2262 | 2258 | processLastException(); |
| 2263 | | − } else if (ex) { |
| 2259 | + } else if (ex && utils.isError(ex)) { |
| 2260 | + // non-string `ex` arg; attempt to extract stack trace |
| 2261 | + |
| 2264 | 2262 | // New chrome and blink send along a real error object |
| 2265 | 2263 | // Let's just report that like a normal error. |
| 2266 | 2264 | // See: https://mikewest.org/2013/08/debugging-runtime-errors-with-window-onerror |
| @@ -2703,7 +2701,6 @@ TraceKit.computeStackTrace = (function computeStackTraceWrapper() { · 436 unmodified lines |
| 2703 | 2701 | throw e; |
| 2704 | 2702 | } |
| 2705 | 2703 | } |
| 2706 | | − |
| 2707 | 2704 | return { |
| 2708 | 2705 | 'name': ex.name, |
| 2709 | 2706 | 'message': ex.message, |
| @@ -2720,5 +2717,54 @@ TraceKit.computeStackTrace = (function computeStackTraceWrapper() { · 10 unmodified lines |
| 2720 | 2717 | module.exports = TraceKit; |
| 2721 | 2718 | |
| 2722 | 2719 | }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) |
| 2723 | | −},{}]},{},[5])(5) |
| 2720 | +},{"5":5}],7:[function(_dereq_,module,exports){ |
| 2721 | +'use strict'; |
| 2722 | + |
| 2723 | +/* |
| 2724 | + json-stringify-safe |
| 2725 | + Like JSON.stringify, but doesn't throw on circular references. |
| 2726 | + |
| 2727 | + Originally forked from https://github.com/isaacs/json-stringify-safe |
| 2728 | + version 5.0.1 on 3/8/2017 and modified for IE8 compatibility. |
| 2729 | + Tests for this are in test/vendor. |
| 2730 | + |
| 2731 | + ISC license: https://github.com/isaacs/json-stringify-safe/blob/master/LICENSE |
| 2732 | +*/ |
| 2733 | + |
| 2734 | +exports = module.exports = stringify |
| 2735 | +exports.getSerialize = serializer |
| 2736 | + |
| 2737 | +function indexOf(haystack, needle) { |
| 2738 | + for (var i = 0; i < haystack.length; ++i) { |
| 2739 | + if (haystack[i] === needle) return i; |
| 2740 | + } |
| 2741 | + return -1; |
| 2742 | +} |
| 2743 | + |
| 2744 | +function stringify(obj, replacer, spaces, cycleReplacer) { |
| 2745 | + return JSON.stringify(obj, serializer(replacer, cycleReplacer), spaces) |
| 2746 | +} |
| 2747 | + |
| 2748 | +function serializer(replacer, cycleReplacer) { |
| 2749 | + var stack = [], keys = [] |
| 2750 | + |
| 2751 | + if (cycleReplacer == null) cycleReplacer = function(key, value) { |
| 2752 | + if (stack[0] === value) return '[Circular ~]' |
| 2753 | + return '[Circular ~.' + keys.slice(0, indexOf(stack, value)).join('.') + ']' |
| 2754 | + } |
| 2755 | + |
| 2756 | + return function(key, value) { |
| 2757 | + if (stack.length > 0) { |
| 2758 | + var thisPos = indexOf(stack, this); |
| 2759 | + ~thisPos ? stack.splice(thisPos + 1) : stack.push(this) |
| 2760 | + ~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key) |
| 2761 | + if (~indexOf(stack, value)) value = cycleReplacer.call(this, key, value) |
| 2762 | + } |
| 2763 | + else stack.push(value) |
| 2764 | + |
| 2765 | + return replacer == null ? value : replacer.call(this, key, value) |
| 2766 | + } |
| 2767 | +} |
| 2768 | + |
| 2769 | +},{}]},{},[4])(4) |
| 2724 | 2770 | }); |