|
11 | 11 | } |
12 | 12 | }(this, function () { |
13 | 13 | 'use strict'; |
| 14 | + |
| 15 | + // ES5 Polyfills |
| 16 | + // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind |
| 17 | + if (!Function.prototype.bind) { |
| 18 | + Function.prototype.bind = function (oThis) { |
| 19 | + if (typeof this !== 'function') { |
| 20 | + throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable'); |
| 21 | + } |
| 22 | + |
| 23 | + var aArgs = Array.prototype.slice.call(arguments, 1); |
| 24 | + var fToBind = this; |
| 25 | + var noOp = function () { |
| 26 | + }; |
| 27 | + var fBound = function () { |
| 28 | + return fToBind.apply(this instanceof noOp && oThis ? this : oThis, |
| 29 | + aArgs.concat(Array.prototype.slice.call(arguments))); |
| 30 | + }; |
| 31 | + |
| 32 | + noOp.prototype = this.prototype; |
| 33 | + fBound.prototype = new noOp(); |
| 34 | + |
| 35 | + return fBound; |
| 36 | + }; |
| 37 | + } |
| 38 | + |
| 39 | + // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map |
| 40 | + if (!Array.prototype.map) { |
| 41 | + Array.prototype.map = function(callback, thisArg) { |
| 42 | + if (this === void 0 || this === null) { |
| 43 | + throw new TypeError("this is null or not defined"); |
| 44 | + } |
| 45 | + var O = Object(this); |
| 46 | + var len = O.length >>> 0; |
| 47 | + if (typeof callback !== "function") { |
| 48 | + throw new TypeError(callback + " is not a function"); |
| 49 | + } |
| 50 | + if (arguments.length > 1) { |
| 51 | + var T = thisArg; |
| 52 | + } |
| 53 | + |
| 54 | + var A = new Array(len); |
| 55 | + var k = 0; |
| 56 | + |
| 57 | + while (k < len) { |
| 58 | + var kValue, mappedValue; |
| 59 | + if (k in O) { |
| 60 | + kValue = O[k]; |
| 61 | + mappedValue = callback.call(T, kValue, k, O); |
| 62 | + A[k] = mappedValue; |
| 63 | + } |
| 64 | + k++; |
| 65 | + } |
| 66 | + |
| 67 | + return A; |
| 68 | + }; |
| 69 | + } |
| 70 | + |
| 71 | + // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter |
| 72 | + if (!Array.prototype.filter) { |
| 73 | + Array.prototype.filter = function(callback/*, thisArg*/) { |
| 74 | + if (this === void 0 || this === null) { |
| 75 | + throw new TypeError("this is null or not defined"); |
| 76 | + } |
| 77 | + |
| 78 | + var t = Object(this); |
| 79 | + var len = t.length >>> 0; |
| 80 | + if (typeof callback !== "function") { |
| 81 | + throw new TypeError(callback + " is not a function"); |
| 82 | + } |
| 83 | + |
| 84 | + var res = []; |
| 85 | + var thisArg = arguments.length >= 2 ? arguments[1] : void 0; |
| 86 | + for (var i = 0; i < len; i++) { |
| 87 | + if (i in t) { |
| 88 | + var val = t[i]; |
| 89 | + if (callback.call(thisArg, val, i, t)) { |
| 90 | + res.push(val); |
| 91 | + } |
| 92 | + } |
| 93 | + } |
| 94 | + |
| 95 | + return res; |
| 96 | + }; |
| 97 | + } |
| 98 | + |
14 | 99 | return function ErrorStackParser() { |
15 | 100 | this.firefoxSafariStackEntryRegExp = /\S+\:\d+/; |
16 | 101 | this.chromeIEStackEntryRegExp = /\s+at /; |
|
71 | 156 |
|
72 | 157 | this.parseOpera = function parseOpera(e) { |
73 | 158 | if (!e.stacktrace || (e.message.indexOf('\n') > -1 && |
74 | | - e.message.split('\n').length > e.stacktrace.split('\n').length)) { |
| 159 | + e.message.split('\n').length > e.stacktrace.split('\n').length)) { |
75 | 160 | return this.parseOpera9(e); |
76 | 161 | } else if (!e.stack) { |
77 | 162 | return this.parseOpera10a(e); |
|
0 commit comments