diff --git a/vendor/assets/javascripts/squash_javascript.min.js b/vendor/assets/javascripts/squash_javascript.min.js index 909c07c..43a34bd 100644 --- a/vendor/assets/javascripts/squash_javascript.min.js +++ b/vendor/assets/javascripts/squash_javascript.min.js @@ -1,24 +1,24 @@ -(function(){var m,f={}.hasOwnProperty,h=[].slice,e="undefined"!==typeof exports&&null!==exports?exports:this,k=function(){},v;v=void 0;k.instance=function(){return null!=v?v:v=new m};e.SquashJavascript=k;var e=function(){TraceKit.report.subscribe(function(b,d){return SquashJavascript.instance().report(b,d)})},p,s,x,g;e.prototype.configure=function(b){var d,c,a;this.options||(this.options={disabled:!1,notifyPath:"/api/1.0/notify",transmitTimeout:15E3,ignoredExceptionClasses:[],ignoredExceptionMessages:{}}); -a=[];for(d in b)f.call(b,d)&&(c=b[d],a.push(this.options[d]=c));return a};e.prototype.notify=function(b,d){if(b instanceof Error)return b._squash_user_data=d,TraceKit.report(b);throw b;};e.prototype.report=function(b,d){var c,a,i,l,B,G,q,j,e,k,h,g;try{if(null!=(G=this.options)&&G.disabled)return!1;if(!(null!=(q=this.options)&&q.APIKey)||!(null!=(j=this.options)&&j.environment)||!(null!=(e=this.options)&&e.revision)||!(null!=(k=this.options)&&k.APIHost))return console.error("Missing required Squash configuration keys"), -!1;if(this.shouldIgnoreError(b)||!b.stack)return!1;a={};a.api_key=this.options.APIKey;a.environment=this.options.environment;a.client="javascript";a.revision=this.options.revision;a.class_name=null!=(h=b.type)?h:b.name;!b.name&&(l=b.message.match(/^(Uncaught )?(\w+): (.+)/))?(a.class_name=l[2],a.message=l[3]):a.message=b.message;null==a.class_name&&(a.class_name="Error");a.backtraces=x(b.stack);a.capture_method=b.mode;a.occurred_at=p(new Date);a.schema=window.location.protocol.replace(/:$/,"");a.host= -window.location.hostname;0b?"0"+b:b};return""+b.getUTCFullYear()+"-"+d(b.getUTCMonth()+ -1)+"-"+d(b.getUTCDate())+"T"+d(b.getUTCHours())+":"+d(b.getUTCMinutes())+":"+d(b.getUTCSeconds())+"Z"};s=function(b,d){var c,a,i;if(b instanceof Array){a=0;for(i=b.length;af;++f)if(c=e[i-f]+c,void 0!==c&&((j=d.exec(c))||(j=b.exec(c))))return j[1];return"?"}function h(a,b){var l=m(a),c=[],d=!1;if(!l.length)return null;for(var b=b-1,e=b-2,f=b+2;e","(?:>|>)").replace("&","(?:&|&)").replace('"','(?:"|")').replace(/\s+/g,"\\s+")}function v(a,b){for(var l,c,d=0,e=b.length;dl&&(c=a.exec(b[l]))?c.index:null} -function s(a){var b=[window.location.href],c=document.getElementsByTagName("script"),a=""+a,d;for(d=0;d]+)>|([^\)]+))\((.*)\) in (.*):\s*$/i,s=a.stacktrace.split("\n"),q=[],j,x=0,L=s.length;xz.length)c=null;else{D=/^\s*Line (\d+) of linked script ((?:file|http)\S+)(?:: in function (\S+))?\s*$/i;r=/^\s*Line (\d+) of inline#(\d+) script in ((?:file|http)\S+)(?:: in function (\S+))?\s*$/i;t=/^\s*Line (\d+) of function script\s*$/i;var C=[],n=document.getElementsByTagName("script"),F=[],y,u,H,A;for(u in n)n.hasOwnProperty(u)&&!n[u].src&&F.push(n[u]);u=2;for(H=z.length;ub?"0"+b:b};return""+b.getUTCFullYear()+"-"+c(b.getUTCMonth()+1)+"-"+c(b.getUTCDate())+"T"+c(b.getUTCHours())+":"+c(b.getUTCMinutes())+":"+c(b.getUTCSeconds())+"Z"};s=function(b,c){var e,a,d;if(b instanceof Array){a=0;for(d=b.length;ag;++g)if(e=f[a-g]+e,void 0!==e&&((h=d.exec(e))||(h=c.exec(e))))return h[1];return"?"}function d(b,a){var c=q(b),d=[],e=!1;if(!c.length)return null;a-=1;for(var f=a-2,h=a+2;f","(?:>|>)").replace("&","(?:&|&)").replace('"','(?:"|")').replace(/\s+/g,"\\s+")}function l(b,a){for(var c,d,e=0,f=a.length;ec&&(d=b.exec(a[c]))?d.index:null}function b(b){var a=[window.location.href],c=document.getElementsByTagName("script");b=""+b;var d;for(d=0;d]+)>|([^\)]+))\((.*)\) in (.*):\s*$/i,m=a.stacktrace.split("\n"), +k=[],h,n=0,C=m.length;ny.length)c=null;else{D=/^\s*Line (\d+) of linked script ((?:file|https?)\S+)(?:: in function (\S+))?\s*$/i;r=/^\s*Line (\d+) of inline#(\d+) script in ((?:file|https?)\S+)(?:: in function (\S+))?\s*$/i;t=/^\s*Line (\d+) of function script\s*$/i;var B=[],p=document.getElementsByTagName("script"),F=[],w,u,L,z;for(u in p)p.hasOwnProperty(u)&&!p[u].src&&F.push(p[u]);u=2;for(L=y.length;u< +L;u+=2){p=null;if(w=D.exec(y[u]))p={url:w[2],func:w[3],line:+w[1]};else if(w=r.exec(y[u])){var p={url:w[3],func:w[4]},R=+w[1],M=F[w[2]-1];if(M&&(z=q(p.url))){z=z.join("\n");var N=z.indexOf(M.innerText);0<=N&&(p.line=R+z.substring(0,N).split("\n").length)}}else if(w=t.exec(y[u])){var O=window.location.href.replace(/#.*$/,""),S=w[1],T=RegExp(s(y[u+1]));z=l(T,[O]);p={url:O,line:z?z.line:S,func:""}}if(p){p.func||(p.func=g(p.url,p.line));var E=d(p.url,p.line),U=E?E[Math.floor(E.length/2)]:null;E&&U.replace(/^\s*/, +"")===y[u+1].replace(/^\s*/,"")?p.context=E:p.context=[y[u+1]];B.push(p)}}c=B.length?{mode:"multiline",name:a.name,message:y[0],stack:B}:null}if(c)return c}catch(V){if(x)throw V;}try{if(c=e(a,b+1))return c}catch(W){if(x)throw W;}return{mode:"failed"}}var x=!1,C={};a.augmentStackTraceWithInitialElement=c;a.guessFunctionName=g;a.gatherContext=d;a.ofCaller=function(b){b=(void 0===b?0:+b)+1;try{0()}catch(c){return a(c,b+1)}return null};return a}(); +(function(m){var q=Array.prototype.slice,g=m.setTimeout;m.setTimeout=function(){var d=q.call(arguments,0),m=d[0];d[0]=function(){try{m.apply(this,arguments)}catch(d){throw TraceKit.report(d),d;}};return g.apply(this,d)};var d=m.setInterval;m.setInterval=function(){var f=q.call(arguments,0),g=f[0];f[0]=function(){try{g.apply(this,arguments)}catch(d){throw TraceKit.report(d),d;}};return d.apply(this,f)}})(window); diff --git a/vendor/assets/javascripts/squash_javascript.orig.js b/vendor/assets/javascripts/squash_javascript.orig.js index 2609fcf..f6a6bee 100644 --- a/vendor/assets/javascripts/squash_javascript.orig.js +++ b/vendor/assets/javascripts/squash_javascript.orig.js @@ -85,6 +85,9 @@ } else { fields.message = info.message; } + if (fields.message) { + fields.message = fields.message.substring(0, 1000); + } if ((_ref6 = fields.class_name) == null) { fields.class_name = 'Error'; } @@ -96,10 +99,10 @@ if (window.location.port.length > 0) { fields.port = window.location.port; } - fields.path = window.location.pathname; - fields.query = window.location.search; + fields.path = window.location.pathname.substring(0, 500); + fields.query = window.location.search.substring(0, 255); if (window.location.hash !== '') { - fields.fragment = window.location.hash; + fields.fragment = window.location.hash.substring(0, 255); } fields.user_agent = navigator.userAgent; fields.screen_width = screen.width; @@ -214,14 +217,22 @@ context = null; } backtraces.push({ - url: line.url, - line: line.line, + url: line.url || "unknown", + line: line.line || 1, column: line.column, symbol: line.func, context: context, type: 'minified' }); } + if (backtraces.length === 0) { + backtraces.push({ + url: "fake", + line: 1, + symbol: "", + type: 'minified' + }); + } return [ { name: "Active Thread", diff --git a/vendor/assets/javascripts/squash_javascript/client.coffee b/vendor/assets/javascripts/squash_javascript/client.coffee index da6a5f5..35712af 100644 --- a/vendor/assets/javascripts/squash_javascript/client.coffee +++ b/vendor/assets/javascripts/squash_javascript/client.coffee @@ -91,6 +91,7 @@ class _SquashJavascript fields.message = matches[3] else fields.message = info.message + fields.message = fields.message.substring(0,1000) if fields.message fields.class_name ?= 'Error' # when all else fails fields.backtraces = buildBacktrace(info.stack) @@ -100,9 +101,9 @@ class _SquashJavascript fields.schema = window.location.protocol.replace(/:$/, '') fields.host = window.location.hostname fields.port = window.location.port if window.location.port.length > 0 - fields.path = window.location.pathname - fields.query = window.location.search - fields.fragment = window.location.hash if window.location.hash != '' + fields.path = window.location.pathname.substring(0,500) + fields.query = window.location.search.substring(0,255) + fields.fragment = window.location.hash.substring(0,255) if window.location.hash != '' fields.user_agent = navigator.userAgent @@ -203,7 +204,12 @@ class _SquashJavascript for line in stack context = line.context context = null if context && any(context, (cline) -> cline && cline.length > 200) - backtraces.push {url: line.url, line: line.line, column: line.column, symbol: line.func, context: context, type: 'minified'} + backtraces.push {url: line.url || "unknown", line: line.line || 1, column: line.column, symbol: line.func, context: context, type: 'minified'} + # The server doesn't allow empty backtraces. We fake one to + # make sure the error arrives anyway. + if backtraces.length == 0 + backtraces.push {url: "fake", line: 1, symbol: "", type: 'minified'} + return [ {name: "Active Thread", faulted: true, backtrace: backtraces} ] ISODateString = (d) -> diff --git a/vendor/assets/javascripts/squash_javascript/tracekit.js b/vendor/assets/javascripts/squash_javascript/tracekit.js index 7206bd6..941b57c 100644 --- a/vendor/assets/javascripts/squash_javascript/tracekit.js +++ b/vendor/assets/javascripts/squash_javascript/tracekit.js @@ -548,8 +548,8 @@ TraceKit.computeStackTrace = (function () { return null; } - var chrome = /^\s*at (?:new )?(.+) (?:\[as \S+\] )?\(((?:file|http):.*?):(\d+)(?::(\d+))?\)\s*$/i, - gecko = /^\s*(\S*)(?:\((.*?)\))?@((?:file|http).*?):(\d+)(?::(\d+))?\s*$/i, + var chrome = /^\s*at (?:new )?(.+) (?:\[as \S+\] )?\(((?:file|https?):.*?):(\d+)(?::(\d+))?\)\s*$/i, + gecko = /^\s*(\S*)(?:\((.*?)\))?@((?:file|https?).*?):(\d+)(?::(\d+))?\s*$/i, lines = ex.stack.split("\n"), stack = [], parts, @@ -674,8 +674,8 @@ TraceKit.computeStackTrace = (function () { return null; } - var lineRE1 = /^\s*Line (\d+) of linked script ((?:file|http)\S+)(?:: in function (\S+))?\s*$/i, - lineRE2 = /^\s*Line (\d+) of inline#(\d+) script in ((?:file|http)\S+)(?:: in function (\S+))?\s*$/i, + var lineRE1 = /^\s*Line (\d+) of linked script ((?:file|https?)\S+)(?:: in function (\S+))?\s*$/i, + lineRE2 = /^\s*Line (\d+) of inline#(\d+) script in ((?:file|https?)\S+)(?:: in function (\S+))?\s*$/i, lineRE3 = /^\s*Line (\d+) of function script\s*$/i, stack = [], scripts = document.getElementsByTagName('script'),